home *** CD-ROM | disk | FTP | other *** search
- package java.awt.image;
-
- import java.util.Hashtable;
-
- public class MemoryImageSource implements ImageProducer {
- int width;
- int height;
- ColorModel model;
- Object pixels;
- int pixeloffset;
- int pixelscan;
- Hashtable properties;
- private ImageConsumer theConsumer;
-
- public MemoryImageSource(int var1, int var2, ColorModel var3, byte[] var4, int var5, int var6) {
- this.initialize(var1, var2, var3, var4, var5, var6, (Hashtable)null);
- }
-
- public MemoryImageSource(int var1, int var2, ColorModel var3, byte[] var4, int var5, int var6, Hashtable var7) {
- this.initialize(var1, var2, var3, var4, var5, var6, var7);
- }
-
- public MemoryImageSource(int var1, int var2, ColorModel var3, int[] var4, int var5, int var6) {
- this.initialize(var1, var2, var3, var4, var5, var6, (Hashtable)null);
- }
-
- public MemoryImageSource(int var1, int var2, ColorModel var3, int[] var4, int var5, int var6, Hashtable var7) {
- this.initialize(var1, var2, var3, var4, var5, var6, var7);
- }
-
- private void initialize(int var1, int var2, ColorModel var3, Object var4, int var5, int var6, Hashtable var7) {
- this.width = var1;
- this.height = var2;
- this.model = var3;
- this.pixels = var4;
- this.pixeloffset = var5;
- this.pixelscan = var6;
- if (var7 == null) {
- var7 = new Hashtable();
- }
-
- this.properties = var7;
- }
-
- public MemoryImageSource(int var1, int var2, int[] var3, int var4, int var5) {
- if (ColorModel.RGBdefault == null) {
- ColorModel.RGBdefault = new DirectColorModel(32, 16711680, 65280, 255, -16777216);
- }
-
- this.initialize(var1, var2, ColorModel.RGBdefault, var3, var4, var5, (Hashtable)null);
- }
-
- public MemoryImageSource(int var1, int var2, int[] var3, int var4, int var5, Hashtable var6) {
- if (ColorModel.RGBdefault == null) {
- ColorModel.RGBdefault = new DirectColorModel(32, 16711680, 65280, 255, -16777216);
- }
-
- this.initialize(var1, var2, ColorModel.RGBdefault, var3, var4, var5, var6);
- }
-
- public synchronized void addConsumer(ImageConsumer var1) {
- this.theConsumer = var1;
-
- try {
- this.produce();
- } catch (Exception var2) {
- if (this.theConsumer != null) {
- this.theConsumer.imageComplete(1);
- }
- }
-
- this.theConsumer = null;
- }
-
- public synchronized boolean isConsumer(ImageConsumer var1) {
- return var1 == this.theConsumer;
- }
-
- public synchronized void removeConsumer(ImageConsumer var1) {
- if (this.theConsumer == var1) {
- this.theConsumer = null;
- }
-
- }
-
- public void startProduction(ImageConsumer var1) {
- this.addConsumer(var1);
- }
-
- public void requestTopDownLeftRightResend(ImageConsumer var1) {
- }
-
- private void produce() {
- if (this.theConsumer != null) {
- this.theConsumer.setDimensions(this.width, this.height);
- }
-
- if (this.theConsumer != null) {
- this.theConsumer.setProperties(this.properties);
- }
-
- if (this.theConsumer != null) {
- this.theConsumer.setColorModel(this.model);
- }
-
- if (this.theConsumer != null) {
- this.theConsumer.setHints(30);
- }
-
- if (this.theConsumer != null) {
- if (this.pixels instanceof byte[]) {
- this.theConsumer.setPixels(0, 0, this.width, this.height, this.model, (byte[])this.pixels, this.pixeloffset, this.pixelscan);
- } else {
- this.theConsumer.setPixels(0, 0, this.width, this.height, this.model, (int[])this.pixels, this.pixeloffset, this.pixelscan);
- }
- }
-
- if (this.theConsumer != null) {
- this.theConsumer.imageComplete(3);
- }
-
- }
- }
-